package co.gov.medellin.ssti.sub.service;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.Collection;

import javax.naming.NamingException;

import co.gov.medellin.ssti.sub.common.ConexionFactory;
import co.gov.medellin.ssti.sub.model.dao.DAOFactory;
import co.gov.medellin.ssti.sub.model.dao.IInterfazMELDAO;
import co.gov.medellin.ssti.sub.model.dao.exception.DAOException;
import co.gov.medellin.ssti.sub.model.vo.BeneficiarioVO;
import co.gov.medellin.ssti.sub.model.vo.InterfazMELVO;

public class InterfazMELService {
	public Collection<InterfazMELVO> findCamposGenericos(BeneficiarioVO bene)
			throws DAOException {
		IInterfazMELDAO interfazMELDAO = null;
		try {
			Connection con = ConexionFactory.getInstance().getConnection();
			interfazMELDAO = DAOFactory.getDAOFactory(DAOFactory.ORACLE)
					.getInterfazMELDAO(con);
			return interfazMELDAO.findCamposGenericos(bene);
		} catch (NamingException e) {
			throw new DAOException(e);
		} catch (SQLException e) {
			throw new DAOException(e);
		} finally {
			if (interfazMELDAO != null) {
				if (!interfazMELDAO.isConnClosed()) {
					interfazMELDAO.close();
				}
			}
		}
	}
}
